// 引入 react 依赖
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Text, View, Image, TouchableOpacity, ImageBackground, ScrollView } from 'react-native';

// 引入第三方依赖
import _ from 'lodash';
import pureRender from 'pure-render-decorator';

// antd 按需加载
import { Result } from '@ant-design/react-native';

// 引入 处理数据 所需文件
import { } from './module.js'

// 引入样式
import Styles from './style.js';

// 引入公用组件
import { } from '../../components/index.js'

// 引入工具包
import { data, error, locate, network, order, reload, shoppingCart, store, orderIcon } from '../../util/images.js'
import {   size, ScreenWidth } from '../../util/utils.js'

class Results extends Component {
	static propTypes = {

	}

	constructor(props) {
		super(props)
		this.state = {}
	}

	render() {
		const { type, width, height, ...props } = this.props
		let images
		let title
		let message
		switch (type) {
			case 'data':
				images = data
				title = '暂无数据'
				message = '没有更多了'
				break
			case 'error':
				images = error
				title = '出错了'
				message = '出问题了'
				break
			case 'locate':
				images = locate
				title = '无法获取定位'
				message = '请在设置中打开定位开关'
				break
			case 'network':
				images = network
				title = '无网络'
				message = '请打开网络开关'
				break
			case 'order':
				images = order
				title = '暂无数据'
				message = '没有更多了'
				break
			case 'reload':
				images = reload
				title = '重新加载数据'
				message = '没有更多了'
				break
			case 'shoppingCart':
				images = shoppingCart
				title = '购物车暂无商品'
				message = '没有更多了'
				break
			case 'orderIcon':
				images = orderIcon
				title = ' '
				message = '暂无订单'
				break
			case 'store':
				images = store
				title = ' '
				message = '暂无商家'
				break
		}
		return (
			<Result
				style={{
					backgroundColor:'none'
				}}
				img={
					<Image
						source={images}
						style={{
							width: width || size(750),
							height: height || size(440)
						}}
					/>
				}
				title={title}
				message={message}
				{...props}
			/>
		)
	}
}

export default pureRender(Results)
